define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'fabu/index',
        add_url: 'fabu/add',
        edit_url: 'fabu/edit',
        delete_url: 'fabu/delete',
        export_url: 'fabu/export',
        modify_url: 'fabu/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '添加',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-full="true"',
                    }],
                    'delete', 'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '序号',width: 80},
                    {field: 'member_phone', title: '用户手机号',width: 120},
                    {field: 'game', title: '游戏名称',width: 120},
                    {field: 'device', title: '服务器名称',width: 120},
                    {field: 'price', title: '价格',width: 120},
                    {field: 'name', title: '主号名称',width: 120},
                    {field: 'sex', title: '主号性别',width: 120},
                    {field: 'level', title: '主号等级',width: 120},
                    {field: 'zhiye', title: '主号职业',width: 120},
                    {field: 'jineng', title: '主号技能',width: 120},
                    {field: 'zhuangbei', title: '主号装备',width: 120},
                    {field: 'shengwang', title: '声望',width: 120},
                    {field: 'czfh', title: '充值封号',width: 120},
                    {field: 'person_name', title: '英雄名称',width: 120},
                    {field: 'person_level', title: '英雄等级',width: 120},
                    {field: 'person_zhiye', title: '英雄职业',width: 120},
                    {field: 'person_jineng', title: '英雄技能',width: 120},
                    {field: 'person_zhuangbei', title: '英雄装备',width: 120},
                    {field: 'is_lv', title: '是否绿通',width: 120},
                    {field: 'is_tx', title: '是否至尊通行证',width: 120},
                    {field: 'desc', title: '描述',width: 120},
                    {field: 'hot', title: '人气',width: 120},
                    {field: 'create_at', title: '金令到期时间',width: 120},
                    {field: 'phone', title: '提交手机号',width: 120},
                    {field: 'weixin', title: '提交微信号',width: 120},
                    {field: 'create_time', title: '添加时间',width: 120},
                    {field: 'sort', title: '排序', edit: 'text',width: 80},
                    {field: 'status', search: 'select', selectList: ["禁用","启用"], title: '状态',width: 120, templet: ea.table.switch},
                    {field: 'is_shenhe', search: 'select', selectList: ["驳回","待审核","通过"],width: 120, title: '审核状态'},
                    {field: 'shenhe_reason', title: '审核的驳回原因',width: 120},

                    {
                        width: 250, title: '操作', 
                        templet: ea.table.tool,operat: [
                            [{
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-full="true"',
                            }]
                            ,'delete'
                        ]
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});